
from selenium.webdriver.common.by import By


from LoginCart.base.basePage import BasePage, BaseHandle

#对象库
class PageHome(BasePage):
    def __init__(self):
        super().__init__()
        self.find_login_text=By.CSS_SELECTOR, ".red"
        self.find_index_text=By.CSS_SELECTOR, "[href='/Home/Index/index.html']"
        self.find_input_text=By.CSS_SELECTOR,"#q"
        self.fing_search_text=By.CSS_SELECTOR,"[class='ecsc-search-button']"
    def find_login_btn(self):
        return self.get_element(self.find_login_text)
    def find_index_btn(self):
        return self.get_element(self.find_index_text)
    def find_input_btn(self):
        return self.get_element(self.find_input_text)
    def find_search_btn(self):
        return self.get_element(self.fing_search_text)

#操作库
class HandleHome(BaseHandle):
    def __init__(self):
        self.page_home=PageHome()
    def click_login_btn(self):
        self.page_home.find_login_btn().click()
    def click_index_btn(self):
        self.page_home.find_index_btn().click()
    def send_input_btn(self):
        self.input_text(self.page_home.find_input_btn(),"小米")
    def click_search_btn(self):
        self.page_home.find_search_btn().click()

# 业务层
class ProxyHome:
    def __init__(self):
        self.handleHome=HandleHome()

    def go_login(self):
        self.handleHome.click_login_btn()

    def go_index(self):
        self.handleHome.click_index_btn()

    def go_search(self):
        self.handleHome.send_input_btn()
        self.handleHome.click_search_btn()








